{extend name="base" /}
{block name="title"}{$userInfo['nickname']}-修改信息|程序员的收藏夹-专注于程序员学习、分享{/block}

{block name="style"}
<style type="text/css">
	.box-title.icon::before{
		color: #4a4a4a;
	}
</style>
{/block}

{block name="header"}
	{include file="public/user_header" /}
{/block}

{block name="content"}
<div class="zbd-content">
	<div class="page">
		<div class="user-home">
			<div class="home-menu left yy">
				{include file="public/user_left_nav" /}
			</div>
			<div class="home-body right">
				<div class="row">
					<div class="w12">
						<div class="box yy">
							<div class="box-title icon ice-mass">
								<div class="left bold">我的资料</div>
								<a href="javascript:history.go(-1);" class="right cursor-pointer"><div class="ice-revoke-left black"><span class="small"> 返回</span></div></a>
							</div>
							<div class="box-content">
								<div class="profile">
									<form id="formData">
										<fieldset>
										    <legend class="bg-red">基本信息</legend>
										    <div class="group-form">
											    <div class="group-label">&nbsp;</div>
											    <div class="iceUpload-single" data-img="true" data-name="file" data-url="/Upload/uploadPic" data-success="imgSuccess1" >
												    <img src="{$userInfo['avatar']}" alt="" style="width: 60px;height: 60px;border-radius: 50%; padding: 2px;">
												    <div class="btn min icon ice-upload"> 上传</div>
												</div>
											</div>
											
											<input type="hidden" name="avatar" id="avatar" value="{$userInfo['avatar']}">

											<div class="group-form">
											    <div class="group-label">昵称</div>
											    <div class="group-content">
											        <input type="text" class="form-control" name="nickname" placeholder="请输入" value="{$userInfo['nickname']}">
											    </div>
											</div>
											
											<div class="group-form">
											    <div class="group-label">性别</div>
											    <div class="group-content" style="margin-top: 10px;">
											        <div class="radio">
											            <input type="radio" name="gender" id="gender-1" {if condition="$userInfo['gender']=='男'"}checked{/if} value="男">
											            <label for="gender-1">男</label>
											        </div>
											        <div class="radio">
											            <input type="radio" name="gender" id="gender-2" {if condition="$userInfo['gender']=='女'"}checked{/if} value="女">
											            <label for="gender-2">女</label>
											        </div>
											        <div class="radio">
											            <input type="radio" name="gender" id="gender-3" {if condition="$userInfo['gender']=='保密'"}checked{/if} value="保密">
											            <label for="gender-3">保密</label>
											        </div>
											    </div>
											</div>

											<div class="group-form">
											    <div class="group-label">地区</div>
											    <div class="group-content">
											        <input type="text" id="city-picker1" class="form-control" name="region" placeholder="请选择所在地区" value="{$userInfo['region']}">
											    </div>
											</div>

											<div class="group-form">
											    <div class="group-label">简介</div>
											    <div class="group-content">
											        <textarea class="form-control" name="descs" placeholder="请输入">{$userInfo['descs']}</textarea>
											        <small class="help">默认截取80字做为简介</small>
											    </div>
											</div>
										</fieldset>

										<fieldset>
										    <legend class="bg-blue">教育信息</legend>
										    <div class="group-form">
											    <div class="group-label">学校名称</div>
											    <div class="group-content">
											        <input type="text" class="form-control" name="school" placeholder="请输入学校名称" value="{$userInfo['school']}">
											    </div>
											</div>
											<div class="group-form">
											    <div class="group-label">专业名称</div>
											    <div class="group-content">
											        <input type="text" class="form-control" name="major" placeholder="请输入专业名称" value="{$userInfo['major']}">
											    </div>
											</div>

											<div class="group-form">
											    <div class="group-label">入学日期</div>
											    <div class="group-content">
											        <input type="text" id="entrance" name="entrance" value="{$userInfo['entrance']}" placeholder="请选择入学日期" class="iceDate-icon">
											    </div>
											</div>

											<div class="group-form">
											    <div class="group-label">学历</div>
											    <div class="group-content" style="margin-top: 10px;">
											        <div class="radio">
											            <input type="radio" name="education" id="education-1" {if condition="$userInfo['education']=='大专'"}checked{/if} value="大专">
											            <label for="education-1">大专</label>
											        </div>
											        <div class="radio">
											            <input type="radio" name="education" id="education-2" {if condition="$userInfo['education']=='本科'"}checked{/if} value="本科">
											            <label for="education-2">本科</label>
											        </div>
											        <div class="radio">
											            <input type="radio" name="education" id="education-3" {if condition="$userInfo['education']=='博士'"}checked{/if} value="博士">
											            <label for="education-3">博士</label>
											        </div>
											        <div class="radio">
											            <input type="radio" name="education" id="education-4" {if condition="$userInfo['education']=='研究生'"}checked{/if} value="研究生">
											            <label for="education-4">研究生</label>
											        </div>
											    </div>
											</div>

										</fieldset>

										<div class="group-form">
										    <div class="group-label"></div>
										    <div class="group-content">
										        <input type="button" class="btn bg-green mr20" id="submit" value="提交">
										    </div>
										</div>
									</form>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script src="/static/web/zbdui/src/date/iceDate.js"></script>
<script src="/static/web/zbdui/src/area/iceArea.js"></script>
<script type="text/javascript">

	function imgSuccess1(e,list){
        ice("#avatar").val(e.url)
    }

	ice(function(){

		//标准
		ice.area('city-picker1',function(e){
		    //this: 整个area对象，包含所有的元素节点和地区选择信息
		    //e: 地区返回值，是一个json对象，字段如下
		    //city: "石家庄市"
		    //district: "行唐县"
		    //province: "河北省"
		    //value: "河北省 石家庄市 行唐县"
		    console.log(e);
		});

		//年份选择
		ice.date({id:'entrance',format: 'y-m-d'});

		ice("#submit").click(function(e){
			var data = ice('#formData').form();
			console.log(data)
			if(data.nickname == ''){
				ice.pop({content:'请输入昵称',icon:'fail'})
				return false;
			}
			// ice.pop({content:'Loading...',icon:'none'})
			ice.ajax({
			    url:'/user/profile',
			    type:'post',
			    data:data,
			    success:function(res){
			    	ui.loadClose()
			        if(res.code == 1){
			            ice.pop({content:res.message,icon:'fail'})
			            return false;
			        }else{
			        	ice.pop({content:res.message,icon:'success'})
			        	setTimeout (function(){
							window.location='/user'
						},2000);//参数是函数名
			        }
			    }
			});
		})
	})
</script>

{/block}